/*
 * Project: com.mmall.common.spring.config
 *
 * File Created at 2019-10-19
 *
 * Copyright 2019 CMCC Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * ZYHY Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license.
 */
package com.mmall.common.spring.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;

/**
 * @author jianghucoding
 * @date 2019-10-19
 */
@Configuration
public class MessageConfig {

    @Autowired
    private PropertiesConfig propertiesConfig;

    @Bean(name = "messageSource")
    public ResourceBundleMessageSource getMessageSource() {
        ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
        resourceBundleMessageSource.setDefaultEncoding(propertiesConfig.getMessageEncoding());
        resourceBundleMessageSource.setBasenames(propertiesConfig.getMessageBasename());
        return resourceBundleMessageSource;
    }
}
